package com.treehouse.northlight.component;

import com.artemis.Component;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;

/**
 * Component Class.
 * 
 * A wrapper class used for classes from other APIs. Classes which can't extend
 * from component itself will be referenced into the wrapper class, allowing the
 * artemis framework to process them in any entity system.
 * 
 * @author Julian Biermann
 * @version 1.0 03.03.2013
 * 
 */
public class SpriteWrapper extends Component {

	private Sprite sprite;

	/**
	 * Constructor
	 * 
	 */
	public SpriteWrapper(Sprite sprite) {
		this.sprite = sprite;
	}

	/**
	 * 
	 * Constructor
	 * 
	 * @param texture
	 *            Texture reference.
	 */
	public SpriteWrapper(Texture texture) {
		this.sprite = new Sprite(texture);
	}

	/**
	 * 
	 * Constructor
	 * 
	 * @param path
	 *            to the stored image.
	 */
	public SpriteWrapper(String path) {
		Texture texture = new Texture(Gdx.files.internal(path));
		this.sprite = new Sprite(texture); // Might get errors when not finding
											// the file.
	}

	/**
	 * @return sprite as Sprite.
	 */
	public Sprite getSprite() {
		return sprite;
	}
}
